SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 51683: The FCMP procedure might return incorrect results with the CAT function

DetailsAboutRate It

When variables that are passed to the FCMP procedure are used with the CAT function, the results are correct. However, if you use new variables with the CAT function that were created using variables that are passed to the FCMP procedure, the results are truncated to the first argument of the CAT function.

The example code below illustrates the truncation of the result of the CAT function with PROC FCMP:

proc fcmp outlib=work.funcs.samples;
   function abc(a $, b $) $;
   fa=a;
   fb=b;
   return(Cat(FA,FB));
   endsub;
quit;

options cmplib=work.funcs;

data one;
   a='hello';
   b='there';
   newvar=abc(a,b);
run;

proc print; 
run;

The result of NEWVAR is "hello" and not "hello there".

To circumvent the issue, you can add a LENGTH statement inside PROC FCMP and create a new variable that is the result of the CAT function. The modified PROC FCMP code is shown below:

proc fcmp outlib=work.funcs.samples;
   function abc(a $, b $) $;
   length temp $15 fa $6 fb $6;
   fa=a;
   fb=b;
   temp=cat(fa,fb);
   return(temp);
   endsub;
quit; 


Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASSolaris for x649.3 TS1M09.4 TS1M7
Linux9.3 TS1M09.4 TS1M7
Linux for x649.3 TS1M09.4 TS1M7
HP-UX IPF9.3 TS1M09.4 TS1M7
64-bit Enabled Solaris9.3 TS1M09.4 TS1M7
64-bit Enabled HP-UX9.3 TS1M09.4 TS1M7
64-bit Enabled AIX9.3 TS1M09.4 TS1M7
Windows Vista for x649.3 TS1M0
Windows 7 Ultimate x649.3 TS1M09.4 TS1M7
Windows Vista9.3 TS1M0
Windows 7 Ultimate 32 bit9.3 TS1M09.4 TS1M7
Windows 7 Professional x649.3 TS1M09.4 TS1M7
Windows 7 Professional 32 bit9.3 TS1M09.4 TS1M7
Windows 7 Home Premium x649.3 TS1M09.4 TS1M7
Windows 7 Home Premium 32 bit9.3 TS1M09.4 TS1M7
Windows 7 Enterprise x649.3 TS1M09.4 TS1M7
Windows 7 Enterprise 32 bit9.3 TS1M09.4 TS1M7
Microsoft Windows XP Professional9.3 TS1M0
Microsoft Windows Server 2008 for x649.3 TS1M09.4 TS1M7
Microsoft Windows Server 2008 R29.3 TS1M09.4 TS1M7
Microsoft Windows Server 20089.3 TS1M09.4 TS1M7
Microsoft Windows Server 2003 for x649.3 TS1M0
Microsoft Windows Server 2003 Standard Edition9.3 TS1M0
Microsoft Windows Server 2003 Enterprise Edition9.3 TS1M0
Microsoft Windows Server 2003 Datacenter Edition9.3 TS1M0
Microsoft® Windows® for x649.3 TS1M09.4 TS1M7
z/OS9.3 TS1M09.4 TS1M7
Z649.3 TS1M09.4 TS1M7
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.